package com.intermancer.predictor.feeder;

import com.intermancer.predictor.data.ConsumeResponse;
import com.intermancer.predictor.data.Quantum;
import com.intermancer.predictor.evaluator.Evaluator;

public class EvaluationHoldCountFCL implements
		FeedCycleListener {
	
	private int threshold;
	private int count;
	private Evaluator evaluator;
	
	public EvaluationHoldCountFCL() {
	}
	
	public EvaluationHoldCountFCL(int threshold, Evaluator evaluator) {
		this.evaluator = evaluator;
		this.threshold = threshold;
	}

	@Override
	public void init() {
		count = 0;
	}

	@Override
	public boolean handle(ConsumeResponse consumeResponse,
			Quantum quantum) {
		count++;
		if(count < threshold) {
			return evaluator.getScore() == 0.0;
		}
		return true;
	}

	public Evaluator getEvaluator() {
		return evaluator;
	}

	public void setEvaluator(Evaluator evaluator) {
		this.evaluator = evaluator;
	}

	public int getThreshold() {
		return threshold;
	}

	public void setThreshold(int threshold) {
		this.threshold = threshold;
	}

}
